<?php /* Smarty version 2.6.26, created on 2012-05-12 15:20:53
         compiled from C:%5CWampDeveloper%5CWebsites%5Cwww.siyaradiali.com%5Cwebroot%5Cplugins%5CimportExportCategories%5Cadmin%5CimportExportCategories.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'cat', 'C:\\WampDeveloper\\Websites\\www.siyaradiali.com\\webroot\\plugins\\importExportCategories\\admin\\importExportCategories.tpl', 14, false),array('modifier', 'replace', 'C:\\WampDeveloper\\Websites\\www.siyaradiali.com\\webroot\\plugins\\importExportCategories\\admin\\importExportCategories.tpl', 47, false),)), $this); ?>
<!-- export import categories tpl -->

<!-- navigation bar -->
<div id="nav_bar">
	<?php if ($_GET['action'] == 'import' || ! isset ( $_GET['action'] )): ?>
	<a href="<?php echo $this->_tpl_vars['rlBaseC']; ?>
action=export" class="button_bar"><span class="left"></span><span class="center_export"><?php echo $this->_tpl_vars['lang']['importExportCategories_export']; ?>
</span><span class="right"></span></a>
	<?php endif; ?>
	<?php if ($_GET['action'] == 'export' || ! isset ( $_GET['action'] )): ?>
	<a href="<?php echo $this->_tpl_vars['rlBaseC']; ?>
action=import" class="button_bar"><span class="left"></span><span class="center_import"><?php echo $this->_tpl_vars['lang']['importExportCategories_import']; ?>
</span><span class="right"></span></a>
	<?php endif; ?>
</div>
<!-- navigation bar end -->

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

<?php if (! isset ( $_GET['action'] )): ?>
	<img src="<?php echo @RL_PLUGINS_URL; ?>
importExportCategories/admin/static/example.png" alt="" title="" />
	<div class="clear"></div>
<?php elseif ($_GET['action'] == 'import'): ?>
	<?php if (! $_SESSION['file_info']): ?>
		<form action="<?php echo $this->_tpl_vars['rlBaseC']; ?>
action=import" method="post" enctype="multipart/form-data" onsubmit="return submit_form();">
		<input type="hidden" name="submit" value="1" />
			<table class="form">
			<tr>
				<td class="name">
					<span class="red">*</span><?php echo $this->_tpl_vars['lang']['file']; ?>

				</td>
				<td class="field">
					<input type="file" class="file" name="file_import" />
				</td>
			</tr>
			<tr>
				<td></td>
				<td class="field">
					<input class="submit" type="submit" value="<?php echo $this->_tpl_vars['lang']['importExportCategories_import']; ?>
" />
				</td>
			</tr>
			</table>
		</form>

		<script type="text/javascript">
		<?php echo '
			var submit_form = function() {
				var importFile = $(\'[name=file_import]\').val();
				if ( importFile == \'\' ) {
					
					printMessage(\'error\', \''; ?>
<?php echo ((is_array($_tmp=$this->_tpl_vars['lang']['importExportCategories_import_filename_empty'])) ? $this->_run_mod_handler('replace', true, $_tmp, "[field]", $this->_tpl_vars['lang']['file']) : smarty_modifier_replace($_tmp, "[field]", $this->_tpl_vars['lang']['file'])); ?>
<?php echo '\');
					return false;
				}
				else {
					if ( importFile.split(\'.\')[1] != \'xls\' ) {
						printMessage(\'error\', \''; ?>
<?php echo $this->_tpl_vars['lang']['importExportCategories_incorrect_file_ext']; ?>
<?php echo '\');
						return false;
					}
				}
				return true;
			}
		'; ?>
	
		</script>
	<?php else: ?>
		<form action="<?php echo $this->_tpl_vars['rlBaseC']; ?>
action=import" method="post">
			<input type="hidden" name="categories_add" value="add" />
			<input type="hidden" name="test" value="1" />

			<table id="import_table" class="form">
			<thead>
			<tr>
				<th></th>
			<?php $_from = $this->_tpl_vars['selector_tr']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['hCaption']):
?>
				<th id="col_<?php echo $this->_tpl_vars['hKey']; ?>
" class="list_td" style="padding:4px;">
					<?php $this->assign('trName', ((is_array($_tmp='importExportCategories_selector_tr_')) ? $this->_run_mod_handler('cat', true, $_tmp, $this->_tpl_vars['hCaption']) : smarty_modifier_cat($_tmp, $this->_tpl_vars['hCaption']))); ?>
					<b><?php echo $this->_tpl_vars['lang'][$this->_tpl_vars['trName']]; ?>
</b>
				</th>
			<?php endforeach; endif; unset($_from); ?>
			</tr>
			</thead>

			<tfoot>
			<tr>
				<th></th>
			<?php $_from = $this->_tpl_vars['selector_tr']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['fKey']):
?>
				<th id="col_<?php echo $this->_tpl_vars['fKey']; ?>
" class="list_td" style="padding:4px;">
					<?php if ($this->_tpl_vars['fKey'] == 'type'): ?>
						<select class="importBorder" id="changeAllType">
							<?php $_from = $this->_tpl_vars['listing_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['lType'] => $this->_tpl_vars['type']):
?>
							<option value="<?php echo $this->_tpl_vars['type']['Key']; ?>
"><?php echo $this->_tpl_vars['type']['name']; ?>
</option>
							<?php endforeach; endif; unset($_from); ?>
						</select>
					<?php elseif ($this->_tpl_vars['fKey'] == 'lock'): ?>
						<select class="importBorder" id="changeAllLock">
							<option value="0"><?php echo $this->_tpl_vars['lang']['no']; ?>
</option>
							<option value="1"><?php echo $this->_tpl_vars['lang']['yes']; ?>
</option>
						</select>
					<?php endif; ?>
				</th>
			<?php endforeach; endif; unset($_from); ?>
			</tr>
			</tfoot>

			<?php $_from = $this->_tpl_vars['cats_array']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['csv']):
?>
			<?php $this->assign('csv_val', $this->_tpl_vars['cats_array'][$this->_tpl_vars['key']]); ?>
				<tr id="row_<?php echo $this->_tpl_vars['key']; ?>
" class="<?php if ($_POST['categories'][$this->_tpl_vars['key']]['checkbox'] || ! $_POST['categories_add']): ?>checked<?php else: ?>unckeked<?php endif; ?><?php if (in_array ( $this->_tpl_vars['key'] , $this->_tpl_vars['exist_keys'] )): ?> exist<?php endif; ?>">
					<td class="list_td" style="width:20px; border-bottom:1px #ccc solid; border-right:1px #ccc solid; padding:4px;">
						<input type="checkbox" name="categories[<?php echo $this->_tpl_vars['key']; ?>
][checkbox]" class="row_checkbox" id="row_cb_<?php echo $this->_tpl_vars['key']; ?>
" <?php if (! $_POST['categories_add'] && ! in_array ( $this->_tpl_vars['key'] , $this->_tpl_vars['exist_keys'] )): ?>checked="checked"<?php elseif ($_POST['categories'][$this->_tpl_vars['key']]['checkbox']): ?>checked="checked"<?php endif; ?> onclick="approval_cat('<?php echo $this->_tpl_vars['key']; ?>
');"  />
					</td>
					<?php $_from = $this->_tpl_vars['csv_val']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key2'] => $this->_tpl_vars['csv_value']):
?>
						<td <?php if (( $this->_tpl_vars['key']%2 ) == 0): ?>class="list_td_light"<?php else: ?>class="divider"<?php endif; ?> style="border-bottom:1px #ccc solid; padding:4px;">
							<?php if ($this->_tpl_vars['key2'] == 'key'): ?>
								<?php if (in_array ( $this->_tpl_vars['key'] , $this->_tpl_vars['exist_keys'] )): ?>
								<input type="hidden" name="categories[<?php echo $this->_tpl_vars['key']; ?>
][exist]" value="yes">
								<?php endif; ?>
								<input type="hidden" name="categories[<?php echo $this->_tpl_vars['key']; ?>
][key]" value="<?php echo $this->_tpl_vars['csv_value']; ?>
">
								<span><?php echo $this->_tpl_vars['csv_value']; ?>
</span>
							<?php elseif ($this->_tpl_vars['key2'] == 'parent'): ?>
								<input type="hidden" name="categories[<?php echo $this->_tpl_vars['key']; ?>
][parent]" value="<?php if (! empty ( $this->_tpl_vars['csv_value'] )): ?><?php echo $this->_tpl_vars['csv_value']; ?>
<?php else: ?>0<?php endif; ?>">
								<span><?php if (! empty ( $this->_tpl_vars['csv_value'] )): ?><?php echo $this->_tpl_vars['csv_value']; ?>
<?php else: ?><?php echo $this->_tpl_vars['lang']['importExportCategories_no_parent']; ?>
<?php endif; ?></span>
							<?php elseif ($this->_tpl_vars['key2'] == 'lock'): ?>
								<select name="categories[<?php echo $this->_tpl_vars['key']; ?>
][lock]" class="importBorder allLock">
									<option value="0" <?php if ($this->_tpl_vars['csv_value'] == '0'): ?>selected="true"<?php endif; ?>><?php echo $this->_tpl_vars['lang']['no']; ?>
</option>
									<option value="1"<?php if ($this->_tpl_vars['csv_value'] == '1'): ?>selected="true"<?php endif; ?>><?php echo $this->_tpl_vars['lang']['yes']; ?>
</option>
								</select>
							<?php elseif ($this->_tpl_vars['key2'] == 'type'): ?>
								<select name="categories[<?php echo $this->_tpl_vars['key']; ?>
][type]" class="importBorder allType">
									<?php $_from = $this->_tpl_vars['listing_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['typeKey'] => $this->_tpl_vars['type']):
?>
									<option value="<?php echo $this->_tpl_vars['type']['Key']; ?>
"><?php echo $this->_tpl_vars['type']['name']; ?>
</option>
									<?php endforeach; endif; unset($_from); ?>
								</select>
							<?php else: ?>
								<input name="categories[<?php echo $this->_tpl_vars['key']; ?>
][<?php echo $this->_tpl_vars['key2']; ?>
]" type="text" class="importBorder" <?php if (isset ( $_POST['categories'] ) && ! empty ( $_POST['categories'] )): ?> value="<?php echo $_POST['categories'][$this->_tpl_vars['key']][$this->_tpl_vars['key2']]; ?>
"<?php else: ?>value="<?php echo $this->_tpl_vars['csv_value']; ?>
"<?php endif; ?> />
							<?php endif; ?>
						</td>
					<?php endforeach; endif; unset($_from); ?>
				</tr>
			<?php endforeach; endif; unset($_from); ?>
			</table>
			<input type="submit" name="test" id="import_bt" class="hide" value="<?php echo $this->_tpl_vars['lang']['importExportCategories_import']; ?>
" />
		</form>

		<script type="text/javascript">
		var flag = 0;
		var empty_text = '<?php echo $this->_tpl_vars['lang']['importExportCategories_empty']; ?>
';
		<?php echo '

		$(document).ready(function(){
			$(\'select#changeAllType\').change(function(){
				var val = $(this).val();
				$(\'select.allType\').find(\'option[value=\'+val+\']\').attr({selected:true});
			});

			$(\'select#changeAllLock\').change(function(){
				var val = $(this).val();
				$(\'select.allLock\').find(\'option[value=\'+val+\']\').attr({selected:true});
			});
		});

		if ( $(\'table#import_table input[type=checkbox]:checked\').length == 0 ) {
			$(\'input#import_bt\').fadeOut(\'fast\');
			flag = 1;
			printMessage(\'info\',empty_text);
		}
		else {
			$(\'input#import_bt\').fadeIn(\'slow\');
		}

		function approval_cat(id) {
			if ( $(\'#row_\'+id).hasClass(\'unckeked\') ) {
				$(\'#row_\'+id).removeClass(\'unckeked\').addClass(\'checked\');
			}
			else {
				$(\'#row_\'+id).addClass(\'unckeked\').removeClass(\'checked\');
			}

			if ( flag == 1 ) {
				$(\'input#import_bt\').fadeIn(\'slow\');
				flag = 0;
			}
			
			if ( $(\'table#import_table input[type=checkbox]:checked\').length == 0 ) {
				$(\'input#import_bt\').fadeOut(\'fast\');
				flag = 1;
				printMessage(\'info\',empty_text);
			}
		}
		'; ?>

		</script>
	<?php endif; ?>
	
<?php elseif ($_GET['action'] == 'export'): ?>

	<form action="<?php echo $this->_tpl_vars['rlBaseC']; ?>
action=export" method="post" onsubmit="return submit_form();">
		<input type="hidden" name="submit" value="1" />
		<table class="form">
		<tr>
			<td>
				<div id="cat_checkboxed" style="margin: 0 0 8px;<?php if ($this->_tpl_vars['sPost']['cat_sticky']): ?>display: none<?php endif; ?>">
					<div class="tree">
						<?php $_from = $this->_tpl_vars['sections']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['section']):
?>
							<fieldset class="light">
								<legend id="legend_section_<?php echo $this->_tpl_vars['section']['ID']; ?>
" class="up" onclick="fieldset_action('section_<?php echo $this->_tpl_vars['section']['ID']; ?>
');"><?php echo $this->_tpl_vars['section']['name']; ?>
</legend>
								<div id="section_<?php echo $this->_tpl_vars['section']['ID']; ?>
">
									<?php if (! empty ( $this->_tpl_vars['section']['Categories'] )): ?>
										<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'category_level_checkbox.tpl') : smarty_modifier_cat($_tmp, 'category_level_checkbox.tpl')), 'smarty_include_vars' => array('categories' => $this->_tpl_vars['section']['Categories'],'first' => true)));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
									<?php else: ?>
										<div style="padding: 0 0 8px 10px;"><?php echo $this->_tpl_vars['lang']['no_items_in_sections']; ?>
</div>
									<?php endif; ?>
								</div>
							</fieldset>
						<?php endforeach; endif; unset($_from); ?>
					</div>
				</div>

				<script type="text/javascript">
				var submit_form;
				var tree_selected = <?php if ($_POST['categories']): ?>[<?php $_from = $_POST['categories']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['postcatF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['postcatF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['post_cat']):
        $this->_foreach['postcatF']['iteration']++;
?>['<?php echo $this->_tpl_vars['post_cat']; ?>
']<?php if (! ($this->_foreach['postcatF']['iteration'] == $this->_foreach['postcatF']['total'])): ?>,<?php endif; ?><?php endforeach; endif; unset($_from); ?>]<?php else: ?>false<?php endif; ?>;
				var tree_parentPoints = <?php if ($this->_tpl_vars['parentPoints']): ?>[<?php $_from = $this->_tpl_vars['parentPoints']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['parentF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['parentF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['parent_point']):
        $this->_foreach['parentF']['iteration']++;
?>['<?php echo $this->_tpl_vars['parent_point']; ?>
']<?php if (! ($this->_foreach['parentF']['iteration'] == $this->_foreach['parentF']['total'])): ?>,<?php endif; ?><?php endforeach; endif; unset($_from); ?>]<?php else: ?>false<?php endif; ?>;
				<?php echo '

				$(document).ready(function(){
					flynax.treeLoadLevel(\'checkbox\', \'flynax.openTree(tree_selected, tree_parentPoints)\', \'div#cat_checkboxed\');
					flynax.openTree(tree_selected, tree_parentPoints);

					$(\'input[name=cat_sticky]\').click(function(){
						$(\'#cat_checkboxed\').slideToggle();
						$(\'#cats_nav\').fadeToggle();
					});
					
					submit_form = function() {
						if ( $(\'#cat_checkboxed input[type=checkbox]:checked\').length > 0 || $(\'input[name=cat_sticky]:checked\').length > 0 ) {
							return true;
						}
						else {
							printMessage(\'info\', \''; ?>
<?php echo $this->_tpl_vars['lang']['importExportCategories_empty']; ?>
<?php echo '\');
							return false;
						}
					}
				});

				'; ?>

				</script>

				<div class="grey_area">
					<label><input class="checkbox" <?php if ($this->_tpl_vars['sPost']['cat_sticky']): ?>checked="checked"<?php endif; ?> type="checkbox" name="cat_sticky" value="true" /> <?php echo $this->_tpl_vars['lang']['sticky']; ?>
</label>
					<span id="cats_nav" <?php if ($this->_tpl_vars['sPost']['cat_sticky']): ?>class="hide"<?php endif; ?>>
						<span onclick="$('#cat_checkboxed div.tree input').attr('checked', true);" class="green_10"><?php echo $this->_tpl_vars['lang']['check_all']; ?>
</span>
						<span class="divider"> | </span>
						<span onclick="$('#cat_checkboxed div.tree input').attr('checked', false);" class="green_10"><?php echo $this->_tpl_vars['lang']['uncheck_all']; ?>
</span>
					</span>
				</div>
			</td>
		</tr>
		<tr>
			<td class="field">
				<input type="submit" id="export_btn" value="<?php echo $this->_tpl_vars['lang']['importExportCategories_export']; ?>
" />
			</td>
		</tr>
		</table>
	</form>
<?php endif; ?>

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

<!-- export import categories tpl end -->